home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / ubiquity / apt-setup / generators / 60local < prev    next >
Encoding:
Text File  |  2008-06-16  |  985 b   |  50 lines

  1. #!/bin/sh
  2. set -e
  3.  
  4. . /usr/share/debconf/confmodule
  5.  
  6. file="$1"
  7.  
  8. chroot=
  9. if [ "$ROOT" ]; then
  10.     chroot=chroot
  11. fi
  12.  
  13. i=0
  14. while db_get "apt-setup/local$i/repository" && [ "$RET" ]; do
  15.     repository="${RET#deb }"
  16.     comment=
  17.     if db_get "apt-setup/local$i/comment"; then
  18.         comment="$RET"
  19.     fi
  20.     key=
  21.     if db_get "apt-setup/local$i/key"; then
  22.         key="$RET"
  23.     fi
  24.     echo >> $file
  25.     if [ -n "$comment" ]; then
  26.         echo "## $comment" >> $file
  27.     fi
  28.     echo "deb $repository" >> $file
  29.     # if true, add a line for deb-src
  30.     if db_get "apt-setup/local$i/source" && [ "$RET" = true ]; then
  31.         echo "deb-src $repository" >> $file
  32.     fi
  33.     if [ -n "$key" ]; then
  34.         # make wget use the proxy
  35.         protocol=${repository%%:*}
  36.         if db_get mirror/$protocol/proxy && [ "$RET" ]; then
  37.             proxy="$RET"
  38.             eval "export ${protocol}_proxy=$proxy"
  39.         fi
  40.         # fetch the key
  41.         wget "$key" -O "$ROOT/tmp/key$i.pub"
  42.         # add it to the keyring
  43.         $chroot $ROOT apt-key add "/tmp/key$i.pub"
  44.         rm -f "$ROOT/tmp/key$i.pub"
  45.     fi
  46.     i="$(($i + 1))"
  47. done
  48.  
  49. exit 0
  50.